		var timer, state;
        var msgDiv, showOptionDiv, hideOptionDiv;

        function init(){
            var container = document.getElementById('container');
            if (!container) {
                return setTimeout(init, 10);
            }
            msgDiv = document.getElementById('optionsDiv');
            showOptionDiv = document.getElementById('showOption');
            hideOptionDiv = document.getElementById('hideOption');
            if(wave && wave.isInWaveContainer()){
                wave.setStateCallback(stateUpdated);
            }
            var participants = wave.getParticipants();
			var select = document.getElementById('participantsGadget');
			for(var i, participant; participant = participants[i]; i++){
				select.options[select.options.length] = new Option(participant.getDisplayName(), participant.getId());
			}
        }

        function stateUpdated(){
            state = wave.getState();
            if(!state || !state.state_){
                return;
            }
        }

        function deleteSelectedOption(){
            state.submitValue('deleteSelectedOption', 1);
        }

        function addElements(){
        	state.submitValue('addElementsOption', 1);
        }

        function deleteElements(){
        	state.submitValue('addElementsOption', 0);
        }
        
        function showRefsInput(){
        	var el = document.getElementById("blipRef");
        	var display = el.style.display;
        	if(display == "none"){
        		el.style.display = "block";
        	}
        	else{
        		el.style.display = "none";
        		gadgets.window.adjustHeight(22);
        		return;
        	}
        	gadgets.window.adjustHeight();
        }
        
        function moveBlips(){
        	var refEl = document.getElementById('inputBlipRef');
        	var value = refEl.value;
        	if(value == ''){
        		alert('Enter name');
        		return;
        	}
        	showRefsInput();
        	state.submitValue('copyLink', value);
        }